<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="wf" uri="/augurit-wf"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>预览建筑企业资质证书</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style type="text/css">
                .inputNoborder {
                    FONT-SIZE: 25px;
                    FONT-FAMILY: 宋体;
                    BORDER-RIGHT: #FFFFFF 1px solid;
                    BORDER-TOP: #FFFFFF 1px solid;
                    BORDER-LEFT: #FFFFFF 1px solid;
                    BORDER-BOTTOM: #FFFFFF 1px solid;
                }
         </style>
         <script src="${ctx}/resources/js/ext/adapter/ext/ext-base.js" type="text/javascript"></script>
         <script src="${ctx}/resources/js/ext/ext-all.js" type="text/javascript"></script>
         <script src="${ctx}/gzcgwsp/resources/js/YwUtil.js" type="text/javascript"></script>
        <script type="text/javascript">
            function printQyzz(){
            	var templateCode = document.getElementById("templateCode").value;
		 		if(templateCode == 'rqrsqjazwxqyzzqx'){
		 			var url="yw-rq-qyzz-info-qx!printnewZzzs.action?id="+${id};
                 	window.open(url);
		 		}else{
		 			var url="yw-rq-qyzz-info!printnewZzzs.action?id="+${id};
                 	window.open(url);
		 		}
                 
               // YwUtil.openWin({url: url, w: 1000, h: 800});
                
           }
          Ext.onReady(function(){
            var hjmc=document.getElementById("hjmc").value;
            if (hjmc=="jbrsj"){//经办人办结改变
              document.getElementById("printzs").style.display='none';
              document.getElementById("savezs").style.display='block';
            }
            if(hjmc=="dzgz"){//打印设置为不可编辑
              document.getElementById("printzs").style.display='block';
              document.getElementById("savezs").style.display='none';
              for (var i = 0; i < document.forms[0].elements.length; i++) {
                    var element = document.forms[0].elements[i];
                     element.readOnly= true; 
               }
            } 
         });
          
          function  saveQyzz(){
	      	var url1;
	        var url2;
	        var templateCode = document.getElementById("templateCode").value;
			if(templateCode == 'rqrsqjazwxqyzzqx'){
				url1 = "${ctx}/yw-rq-qyzz-info-qx!printSave.action";
				url2 = "yw-rq-qyzz-info-qx!preViewZzzs.action?id="+document.getElementById("qxzzId").value+"&hjmc="+hjmc;
			}else{
				url1 = "${ctx}/yw-rq-qyzz-info!printSave.action";
				url2 = "yw-rq-qyzz-info!preViewZzzs.action?id="+document.getElementById("qxzzId").value+"&hjmc="+hjmc;
			}
          	var hjmc=document.getElementById("hjmc").value;
             Ext.Ajax.request({
              method:'post',
              url:url1,
              params:{
                'id':document.getElementById("qxzzId").value,
                'qyxx.id': document.getElementById("qyxxId").value,
                'qyxx.zsbh': document.getElementById("zsbhnum").value,
                'sqdw': document.getElementById("sqdw").value,
                'qyxx.zzdj': document.getElementById("zzdj").value,
                'qyxx.year': document.getElementById("qyxxyear").value,
                'qyxx.month': document.getElementById("qyxxmonth").value,
                'qyxx.day': document.getElementById("qyxxday").value
              },
              success:function(response){
                  var result=response.responseText;
                 if(result=="true"){
                       alert("保存成功");
                       window.location.href=url2;
                 }else{
                     alert("保存失败！");
                 }
              },
              failure: function() {
                alert("保存失败！");
             }, 
              scope:this
           });
          }
        
        </script>
    </head>
    <body>
        <form action="" name="printZzs" method="POST" target="autoPrintIFrame">
        <input type="hidden" id="templateCode" name="templateCode" value="${templateCode}"/>
        <input type="hidden" id="qxzzId" name="id" value="${id}"/>
        <input type="hidden" id="qyxxId" name="qyxx.id" value="${qyxx.id}"/>
        <input type="hidden" name="hjmc" id="hjmc" value="${hjmc}">
        <table width="1100" align="center" style="border:1px solid black;">
            <tr>
                <td width="50%">
                    <table width="100%" border=0>
                        <tr>
                            <td style="text-align:center;"><img src="${ctx}/resources/images/printimg/guohui.jpg" width="200" height="200"/></td>
                        </tr>
                        <tr>
                            <td style="letter-spacing:20px;font-size:40px;text-align:center;font-weight:bold;height:60px;">建筑业企业</td>
                        </tr>
                        <tr>
                            <td style="letter-spacing:60px;font-size:80px;text-align:center;font-weight:bold;height:100px;">资质证书</td>
                        </tr>
                        <tr>
                            <td style="font-size:25px;font-weight:bold;height:100px;valign:middle;padding-left:60px;white-space: nowrap;">
                            证书编号：<input type="text" id="zsbhnum"  name="qyxx.zsbh" class="inputNoborder" value="${qyxx.zsbh}"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="font-size:28px;font-weight:bold;height:50px;valign:middle;text-align:center;">中华人民共和国建设部制</td>
                        </tr>
                    </table>
                </td>
                <td width="50%">
                    <table width="100%" border=0>
                        <tr>
                            <td style="width:130px;font-size:25px;font-weight:bold;height:100px;" valign="top">企业名称：</td>
                            <td style="font-size:25px;font-weight:bold;" valign="top">
                                <textarea name="sqdw" id="sqdw" style="width:350px;height:95px;overflow:hidden;" readonly class="inputNoborder">${sqdw}</textarea>
                            </td>
                        </tr>
                        <tr>
                            <td style="font-size:25px;font-weight:bold;height:317px;valign:top;" valign="top">资质等级：</td>
                            <td style="font-size:25px;font-weight:bold;" valign="top">
                                <textarea name="qyxx.zzdj" id="zzdj" style="width:350px;height:310px;overflow:hidden;" class="inputNoborder">${qyxx.zzdj}</textarea>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td style="font-size:25px;font-weight:bold;height:50px;padding-left:10px;white-space: nowrap;">
                            发证机关：<input type="text" class="inputNoborder" style="FONT-SIZE: 20px;" value="广州市城市管理委员会"/>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td style="font-size:25px;font-weight:bold;height:50px;padding-left:130px;white-space: nowrap;">
                            <input name="qyxx.year" id="qyxxyear" value="${qyxx.year}" class="inputNoborder" style="width:80px;FONT-SIZE: 20px;"/>
                            年
                            <input name="qyxx.month" id="qyxxmonth" value="${qyxx.month}" class="inputNoborder" style="width:42px;FONT-SIZE: 20px;"/>
                            月
                            <input name="qyxx.day"  id="qyxxday" value="${qyxx.day}" class="inputNoborder" style="width:62px;FONT-SIZE: 20px;"/>
                            日
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align:center;"></td>
            </tr>
        </table>
        <table width="1100" align="center"  border="0" style="margin-top:30px;">
            <tr>
                <td align="right" width="50%">
                <input type="button" id="savezs" onclick="saveQyzz();" value="保&nbsp;&nbsp;存" style="width:100px;display:none"/> 
                <input type="button" id="printzs" onclick="printQyzz();" value="打&nbsp;&nbsp;印" style="width:100px;"/>
                </td>
                <td  width="40%" style="">
                <input type="button" value="关闭窗口" onclick="window.close();" style="width:100px;"/>
                </td>
            </tr>
        </table>
        </form>
        <div id="autoPrintDiv" style="display:none;"><iframe height='1000' width='700' name='autoPrintIFrame'/></div>
    </body>
</html>